import request from "@/utils/request";
import { getToken } from "@/utils/storage";
const token = getToken();
export const register = (data) => {
  return request.post("/user/register", data);
};

export const login = (data) => {
  return request.post("/user/login", data);
};

export const getList = (obj) => {
  // const token = getToken();
  return request.get("/interview/query", {
    params: {
      current: obj.current, // 当前页
      pageSize: obj.pageSize, // 每页条数
    },
    headers: {
      Authorization: `Bearer ${token}`,
    },
  });
};

export const getLike = (obj) => {
  // const token = getToken();
  return request.get("/interview/opt/list", {
    headers: {
      Authorization: `Bearer ${token}`,
    },
    params: {
      pageSize: obj.pageSize,
      optType: obj.optType,
    },
  });
};
export const getDetail = (id) => {
  // const token = getToken();
  return request.get("/interview/show", {
    params: {
      id: id,
    },
    headers: {
      Authorization: `Bearer ${token}`,
    },
  });
};

export const update = (data) => {
  // const token = getToken();
  return request.post("/interview/opt", data, {
    headers: {
      Authorization: `Bearer ${token}`,
    },
  });
};
export const getUserInfo = () => {
  const token = getToken();
  return request.get("/user/currentUser", {
    headers: {
      Authorization: `Bearer ${token}`,
    },
  });
};
